/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-01-05 16:33:40
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-01-05 16:50:18
 * @FilePath: \cxl-admin\src\apis\upload\index.ts
 */
import axios from 'axios'
/**
 * 从启动的环境拉取访问的地址
 */
const url = import.meta.env.VITE_HOST

export const getUploadToken = () => {
    return axios({
        method: 'get',
        url: url + '/api/system/file/token',
        params: { showPub: true }
    })
}

/**
 * 上传文件
 * @param file
 * @param showPub
 * @returns
 */
export const uploadFile = (data: FormData) => {
    return axios({
        method: 'post',
        url: url + '/api/system/file/upload',
        data
    })
}
